<?php

namespace app\index\service;

use think\Db;

class BaseService {
	/**
	 * [base_staff_list 获取员工列表]
	 * @DateTime 2018-09-13T18:48:43+0800
	 * @刘家腾
	 * @param    string                   $business_id [商户ID]
	 * @return   [array]                  $base_staff_list      [员工详情列表]
	 */
	public static function base_staff_list($business_id = 0) {

		$base_staff_list = Db::table('staff')
			->where(['business_id' => $business_id, 'state' => 0])
			->select();

		return $base_staff_list;
	}
	/**
	 * [product_info 获取产品详情]
	 * @DateTime 2018-09-14T10:32:34+0800
	 * @刘家腾
	 * @param    integer                  $product_id [description]
	 * @return   [array]                   ¥product_info [产品详情]
	 */
	public static function product_info($product_id = 0) {
		$product_info = Db::table('product')
			->where(['id' => $product_id, 'state' => 0])
			->select();
		return $product_info;
	}
	/**
	 * [synchro_product_info 获取同步产品详情]
	 * @DateTime 2018-09-14T12:27:00+0800
	 * @刘家腾
	 * @param    integer                  $source_product_id [description]
	 * @return   [type]                                      [description]
	 */
	public static function synchro_product_info($product_id = 0) {
		$synchro_product_info = Db::table('product')
			->where(['source_product_id' => $product_id, 'state' => 0])
			->select();
		return $synchro_product_info;
	}
	/**
	 * [orders_list_info 获取订单详情列表]
	 * @DateTime 2018-09-14T12:27:51+0800
	 * @刘家腾
	 * @param    string                   $id [description]
	 * @return   [type]                              [description]
	 */
	public static function orders_list_info($id = '') {
		$orders_list_info = Db::table('orders_info')
			->where(['id' => $id, 'state' => 0])
			->find();
		return $orders_list_info;
	}
	/**
	 * [orders_list_info 获取订单详情列表]
	 * @DateTime 2018-09-14T12:27:51+0800
	 * @刘家腾
	 * @param    string                   $batchcode [description]
	 * @return   [type]                              [description]
	 */
	public static function orders_batchcode_list_info($batchcode = '') {
		$orders_list_info = Db::table('orders_info')
			->where(['batchcode' => $batchcode, 'state' => 0])
			->select();
		return $orders_list_info;
	}

	/**
	 * @Notes:获取一天的0点时间
	 * @param $date
	 * @return bool|string
	 * @author: LiBaoJin
	 * @Time:
	 */
	public static function get_state_date($date){
		$strto = date('Y-m-d',strtotime($date));
		$stare_date = date('Y-m-d H:i:s',strtotime($strto));
		return $stare_date;
	}

	/**
	 * @Notes:根据类型获取大品牌或者小品牌
	 * @param $type
	 * @return false|\PDOStatement|string|\think\Collection
	 * @author: LiBaoJin
	 * @Time:
	 */
	public static function get_product_category($type){
		$category_data = Db::table('product_category')
			->where(['type'=>$type,'state'=>0])
			->select();
		return $category_data;
	}

	/**
	 * @Notes:获取类目
	 * @return false|\PDOStatement|string|\think\Collection
	 * @author: LiBaoJin
	 * @Time:
	 */
	public static function get_product_brand(){
		$category_data = Db::table('product_brand')
			->where(['state'=>0])
			->select();
		return $category_data;
	}








}

?>